﻿using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class ManagerTexture {
	// === Public =====================================================================================================
	public static ManagerTexture CreateInstance() {
		var instance = new ManagerTexture();
		return instance;
	}

	public void Init() {
		_eraserTexture = new List<Texture> {
			Tools.Resources.GetObjectFromResources<Texture>(ResourceConstants.Textures.ERASER)
		};
		_tileTextures = new List<Texture>(Tools.Resources.GetObjectsFromResources<Texture>(ResourceConstants.Textures.FIELDS));
		_wallTextures = new List<Texture>(Tools.Resources.GetObjectsFromResources<Texture>(ResourceConstants.Textures.WALLS));
	}

	public List<Texture> GetTextures(ElementType type) {
		switch (type) {
			case ElementType.Eraser:
				return _eraserTexture;
			case ElementType.Tile:
				return _tileTextures;
			case ElementType.Wall:
				return _wallTextures;
			default:
				return new List<Texture>();
		}
	}

	public Texture GetFirstTexture(ElementType type) {
		switch (type) {
			case ElementType.Eraser:
				return _eraserTexture.First();
			case ElementType.Tile:
				return _tileTextures.First();
			case ElementType.Wall:
				return _wallTextures.First();
			default:
				return null;
		}
	}

	// === Private ====================================================================================================
	private List<Texture> _eraserTexture;
	private List<Texture> _tileTextures;
	private List<Texture> _wallTextures;


}